import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)



import Home from '../pages/Home'
import Login from '../pages/Login'
import Register from '../pages/Register'
import Search from '../pages/Search'
import Detail from '../pages/Detail'
import AddCartSuccess from '../pages/AddCartSuccess'
import ShopCart from '../pages/ShopCart'
import Trade from '../pages/Trade'






export default new VueRouter({
    routes: [
        { path: '/home', component: Home, meta: { show: true } },
        { path: '/Login/', component: Login, meta: false },
        { path: '/Register', component: Register, meta: false },
        { path: '/search', component: Search, meta: { show: true }, name: 'search' },
        { path: '/Detail/:skuid', component: Detail },
        { path: '/AddCartSuccess', component: AddCartSuccess, meta: false },
        { path: '/ShopCart', component: ShopCart, meta: false },
        { path: '/Trade', component: Trade, meta: false },

        //  重定向到home路由 这样可以默认跳转
        { path: '/', redirect: '/home', },
    ],
    scrollBehavior() {
        // y始终滚动到顶部
        return { y: 0 }
    },
})